package cn.item.buckle;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

public class JavaExecuShell {

	public static void main(String[] args) {
		String cmd = "sh /root/test/test.sh " + args[0] + " " + args[1];
		System.out.println("cmd = " + cmd);
		try {
			Process process = Runtime.getRuntime().exec(cmd);
			InputStream in;
			BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
			String flag;
			while ((flag = reader.readLine()) != null) {
				System.out.println("result-------" + flag);
			}
			reader.close();
			process.waitFor();
		} catch (IOException | InterruptedException e) {
			e.printStackTrace();
		}
	}
}
